package com.hitqz.robot.biz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hitqz.robot.api.business.entity.SysConfigEntity;
import com.hitqz.robot.biz.mapper.SysConfigMapper;
import com.hitqz.robot.biz.service.SysConfigService;
import org.springframework.stereotype.Service;

/**
 * @author xupkun
 * @date 2024/8/5
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfigEntity> implements SysConfigService {
    @Override
    public SysConfigEntity getDefaultConfig() {
        SysConfigEntity sysConfigEntity = baseMapper.selectById(1L);
        if (sysConfigEntity == null) {
            sysConfigEntity = new SysConfigEntity();
            sysConfigEntity.setSysName("巡检机器人系统");
            sysConfigEntity.setIndexUri("/dashboard");
            sysConfigEntity.setProjectUri("login_bg.svg");
            sysConfigEntity.setBackgroundUri("bg.png");
            baseMapper.insert(sysConfigEntity);
        }
        return sysConfigEntity;
    }
}
